import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'

// import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/style/theme/index.css'

// import locale from 'element-ui/lib/locale/lang/en' //不要了


//  导入i18n实例
import i18n from '@/lang'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import Components from '@/components'

import '@/icons' // icon
import '@/permission' // permission control
import * as directives from '@/directives'
import * as filters from '@/filters'
// 导入混入
import checkPermission from '@/mixins/checkPermission'
// 全局注册混入  [所有组件都有这个混入对象]
Vue.mixin(checkPermission)

// Vue.use(ElementUI, { locale })
Vue.use(ElementUI, { 
  i18n: (key, value) => i18n.t(key, value)
 })

Vue.use(Components)

Vue.config.productionTip = false

Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

new Vue({
  el: '#app',
  router,
  store,
  i18n, // 挂载i18n, 然后所有的组件都会有个$t的方法
  render: h => h(App)
})
